home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C / Applications / Python 1.3.3 / Python 133 PPC / Mac / Demo / scripting / testeudora.py < prev   
Text File  |  1996-05-19  |  817b  |  38 lines

  1. """A test program that allows us to control Eudora"""
  2.  
  3. import sys
  4. import aetools
  5. import Eudora_Suite
  6. import Required_Suite
  7. import MacOS
  8.  
  9. class Eudora(aetools.TalkTo, Required_Suite.Required_Suite, \
  10.                 Eudora_Suite.Eudora_Suite):
  11.     """A class that can talk to Eudora"""
  12.     pass
  13.     
  14. # The Creator signature of eudora:
  15. SIGNATURE="????"
  16.  
  17. def main():
  18.     talker = Eudora(SIGNATURE)
  19.     while 1:
  20.         print 'get, put, quit (eudora) or exit (this program) ?'
  21.         line = sys.stdin.readline()
  22.         try:
  23.             if line[0] == 'g':
  24.                 talker.connect(checking=1)
  25.             elif line[0] == 'p':
  26.                 talker.connect(sending=1)
  27.             elif line[0] == 'q':
  28.                 talker.quit()
  29.             elif line[0] == 'e':
  30.                 break
  31.         except MacOS.Error, arg:
  32.             if arg[0] == -609:
  33.                 print 'Connection invalid, is eudora running?'
  34.             else:
  35.                 print 'Error, possibly ', arg[1]
  36.             
  37. main()
  38.